<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head lang="en">
	  <meta charset="UTF-8">
	  <title> **** 管理系统  -- 登录</title>
	  <meta http-equiv="X-UA-Compatible" content="IE=edge">
	  <meta name="viewport" content="width=device-width, initial-scale=1">
	  <meta name="format-detection" content="telephone=no">
	  <meta name="renderer" content="webkit">
	  <meta http-equiv="Cache-Control" content="no-siteapp" />
	  <link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
	  <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
	  <style>
	    .header {
	      text-align: center;
	    }
	    .header h1 {
	      font-size: 200%;
	      color: #333;
	      margin-top: 30px;
	    }
	    .header p {
	      font-size: 14px;
	    }
	  </style>
	</head>
	<body>
		<div class="header">
		  <div class="am-g">
		    <h1>Web ide</h1>
		    <p>Integrated Development Environment<br/>代码编辑，代码生成，界面设计，调试，编译</p>
		  </div>
		  <hr />
		</div>
		<div class="am-g">
		  <div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
		    <h3>登录</h3>
		    <hr>
		    <div class="am-btn-group">
		      <a href="#" class="am-btn am-btn-secondary am-btn-sm"><i class="am-icon-github am-icon-sm"></i> Github</a>
		      <a href="#" class="am-btn am-btn-success am-btn-sm"><i class="am-icon-google-plus-square am-icon-sm"></i> Google+</a>
		      <a href="#" class="am-btn am-btn-primary am-btn-sm"><i class="am-icon-stack-overflow am-icon-sm"></i> stackOverflow</a>
		    </div>
		    <br>
		    <br>
		    <form method="post" class="am-form" action="people/peopleLogin.action">
		      <label for="text">用户名:</label>
		      <input type="text" name="userName" id="userName" value="">
		      <br>
		      <label for="password">密码:</label>
		      <input type="password" name="" id="password" value="">
		      <br>
		      <label for="remember-me"> <input id="remember-me" type="checkbox"> 记住密码 </label>
		      <br />
		      <div class="am-cf">
		        <input type="submit" name="" value="登 录" class="am-btn am-btn-primary am-btn-sm am-fl">
		        <input type="submit" name="" value="忘记密码 ^_^? " class="am-btn am-btn-default am-btn-sm am-fr">
		        <button id="" name="" onclick="checkLoad()"> 登录 </button>
		      </div>
		    </form>
		    <hr>
		    <p>© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
		  </div>
		</div>
		
        <script type="text/javascript" src="${pageContext.request.contextPath}/ciAssets/js/jquery-1.11.1.min.js"></script>
		<script type="text/javascript">
			function checkLoad(){
				$.ajax({
					url : "${pageContext.request.contextPath}/people/peopleLogin.action",
				    data : {userName : $("#userName").val(),password: $("#password").val()},
				    type:"POST",
				    dataType:"json",  
					async:false,//是否异步请求，如果是异步，那么不会等服务器返回，我们这个函数就向下运行了。  
					cache:false, 	                
				    success : function(data) {
				    	if (data.success) {
				        	//alert("success [" + data.success+"]");
				            window.location.href="${pageContext.request.contextPath}/ciHomePage.jsp";
							window.event.returnValue=false;
				        } else {
				        	alert("登录失败，请确认用户名密码正确并重新登录!");
				        }
				     }
				 });
			 }
		</script>
	</body>
</html>
